package com.zbkj.crmeb.merchant.admin.controller;

import com.crmeb.core.common.CommonResult;
import com.zbkj.crmeb.store.service.CustomerInsightService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("api/admin/mer/customer/insight")
@Api(tags = "客户洞察")
public class MerCustomerInsightController extends AdminBaseController{

    @Autowired
    private CustomerInsightService customerInsightService;

    /**
     * 功能描述: 指定日期的RF/RM分析数据
     * @Param: [date, type, request]
     * @Return: com.crmeb.core.common.CommonResult<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>>>
     * @Author: wangzh
     * @Date: 2023/1/8 15:40
     */
    @ApiOperation("RF/RM分析")
    @GetMapping
    public CommonResult<Map<String, Map<String, Map<String, Object>>>> getRFAnalysis(@ApiParam("时间") String date, @ApiParam(value = "类型", example = "RF / RM") String type, HttpServletRequest request){
        return CommonResult.success(customerInsightService.getAnalysis(date, type, getMerId(request)));
    }
}
